package com.citi.gts.galto.modules.validation.exception;

import com.citi.gts.galto.modules.validation.constant.BusinessRuleType;
import com.citi.gts.galto.modules.validation.vo.Repair;

public class SubServiceException extends Exception {

    private BusinessRuleType businessRuleType;

    private Repair repair;


    public SubServiceException(Repair repair, String message) {

        super(message);
        this.repair = repair;

        System.out.println("Rule failed. " + repair.rejectionInfo() + " Caused by: \"" + message + '"');

    }

    public SubServiceException(Repair repair, Throwable throwable) {
        super(throwable);
        this.repair = repair;

        System.out.println("Rule failed. " + repair.rejectionInfo() + " Caused by: \"" + throwable.getMessage() + '"');

    }

    public SubServiceException(Repair repair, String message, Throwable throwable) {
        super(message, throwable);
        this.repair = repair;

        System.out.println("Rule failed. " + repair.rejectionInfo() + " Caused by: \"" + message + "\" Nested cause:  \"" + throwable.getMessage() + '"');

    }

    public BusinessRuleType getBusinessRuleType() {
        return businessRuleType;
    }

    public void setBusinessRuleType(BusinessRuleType businessRuleType) {
        this.businessRuleType = businessRuleType;
    }

    public Repair getRepair() {
        return repair;
    }

    public void setRepair(Repair repair) {
        this.repair = repair;
    }
}